package com.bj58.mis.apm.samples.client.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhangfx
 * @create: 2018-06-08 11:37
 **/
@RestController
@RequestMapping("/hello")
public class HelloController {

    @RequestMapping("/{name}")
    public String helloToSome(@PathVariable(name="name") String name, @RequestParam(name="error", required = false) String error){
        System.out.println("helloToSome: " + name);
        if(error!=null){
            throw new RuntimeException(error);
        }
        return "hello " + name;
    }
}
